﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    internal class Program
    {
        static class getNumber
        {
            static public int getMaxNumer(int[] arr)
            {
                int max = 0;

                for(int i = 0; i < arr.Length;i++)
                {
                    if (arr[i] > max)
                    {
                        max = i;
                    }
                }

                return max;
            }
            static public int getMinNumber(int[] arr)
            {
                int min = 0;

                for(int i = 0;i < arr.Length; i++)
                {
                    if (arr[i] < min)
                    {
                        min = i;
                    }
                }

                return min;
            }
            static public int getAverage(int[] arr)
            {
                int sum = 0;
                int avg = 0;

                foreach(int item in arr)
                {
                    sum += item;
                }

                sum = sum / arr.Length;

                return sum;
            }
        }
        static void Main(string[] args)
        {
            int[] arr = { 1, 2, 3, 4,};

            Console.WriteLine("最大值为第{0}个元素",getNumber.getMaxNumer(arr));
            Console.WriteLine("最小值为第{0}个元素",getNumber.getMinNumber(arr));
            Console.WriteLine("平均值为第{0}个元素",getNumber.getAverage(arr));

            Console.Read();
        }
    }
}
